import { defineStore } from 'pinia'
import { getConfig } from '@/api/config'

interface appConfig {
	loginConfig : AnyObject | null
	tabbarConfig : AnyObject | null
    styleConfig : AnyObject | null
    sysConfig : AnyObject | null
}

const useConfigStore = defineStore('configStore', {
	state: () : appConfig => {
		return {
			loginConfig: {},
            tabbarConfig: {},
            styleConfig: {},
            sysConfig: {},
		}
	},
	actions: {
		async getConfig() {
			const data = await getConfig();
            this.loginConfig = data.loginConfig;
            this.tabbarConfig = data.tabbarConfig;
            this.styleConfig = data.styleConfig;
            this.sysConfig = data.sysConfig;
		}
	}
})

export default useConfigStore